package com.wits.qso.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import net.sf.json.JSONObject;
import org.hibernate.annotations.GenericGenerator;
import com.wits.platform.entity.BaseEntity;

/**
 * 
 * 附件表
 */
@Entity
@Table(name = "qso_attachment")
public class Attachment extends BaseEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1838561807083258616L;

	public Attachment() {

	}

	private String id;

	/** 业务数据主键 **/
	private String businessId;

	/** 业务模块类型 **/
	private String businessType;

	/** 原始名称  **/
	private String originalName;

	/** 扩展名 **/
	private String extName;

	private String fileType;

	private long fileSize;
	
	/** 路径 **/
	private String filePath;

	private Date uploadTime;

	// 文件的最后修改时间
	private Date lastModifyDate;

	@Id
	@GeneratedValue(generator = "system-uuid")  
	@GenericGenerator(name = "system-uuid", strategy = "uuid")
	@Column(name = "id")
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(name = "business_id", length = 36)
	public String getBusinessId() {
		return businessId;
	}

	public void setBusinessId(String businessId) {
		this.businessId = businessId;
	}
	
	@Column(name = "business_type", length = 20)
	public String getBusinessType() {
		return businessType;
	}

	public void setBusinessType(String businessType) {
		this.businessType = businessType;
	}

	@Column(name = "original_name", length =100)
	public String getOriginalName() {
		return originalName;
	}

	public void setOriginalName(String originalName) {
		this.originalName = originalName;
	}

	@Column(name = "ext_name", length =20)
	public String getExtName() {
		return extName;
	}

	public void setExtName(String extName) {
		this.extName = extName;
	}

	@Column(name = "file_type", length =30)
	public String getFileType() {
		return fileType;
	}

	public void setFileType(String fileType) {
		this.fileType = fileType;
	}

	@Column(name = "file_size")
	public long getFileSize() {
		return fileSize;
	}

	public void setFileSize(long fileSize) {
		this.fileSize = fileSize;
	}
	
	@Column(name = "file_path",length=200)
	public String getFilePath() {
		return filePath;
	}

	public void setFilePath(String filePath) {
		this.filePath = filePath;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "last_modify_time")
	public Date getLastModifyDate() {
		return lastModifyDate;
	}

	public void setLastModifyDate(Date lastModifyDate) {
		this.lastModifyDate = lastModifyDate;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "upload_time")
	public Date getUploadTime() {
		return uploadTime;
	}

	public void setUploadTime(Date uploadTime) {
		this.uploadTime = uploadTime;
	}

	@Override
	public String display() {
		return this.originalName;
	}

	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return JSONObject.fromObject(this, BaseEntity.getBaseJsonConfig()).toString();
	}

}
